<ui:composition xmlns="http://www.w3.org/1999/xhtml"
                xmlns:ui="http://java.sun.com/jsf/facelets"
                xmlns:h="http://java.sun.com/jsf/html"
                xmlns:f="http://java.sun.com/jsf/core"
                xmlns:a4j="http://richfaces.org/a4j"
                xmlns:rich="http://richfaces.org/rich">
    <style>
        .col, .col2 {
            width:50%;
            vertical-align:top;
        }
        .gridhello {
            border-collapse : collapse;
        }
        .gridhellocolumn {
            padding-left : 0;
        }
        .pic{
            margin-bottom: -4px;
            margin-right: 2px;
            border:none;
        }
    </style>
    <h:form>
        <rich:panel header="客商类型">
            <rich:toolbar  itemSeparator="grid">
                <rich:toolbarGroup>
                    <a4j:commandLink render="edit" action="#{partnertype.add}">
                        <h:graphicImage value="./images/icons/create_doc.gif" styleClass="pic"/>
                    </a4j:commandLink>
                    <a4j:commandLink render="edit" action="#{partnertype.update}">
                        <h:graphicImage value="./images/icons/edit.gif" styleClass="pic"/>
                    </a4j:commandLink>
                    <a4j:commandLink render="edit,errmessage" action="#{partnertype.del}">
                        <h:graphicImage value="./images/icons/delete.gif" styleClass="pic"/>
                    </a4j:commandLink>
                    <a4j:commandLink render="edit,errmessage"  action="#{partnertype.save}">
                        <h:graphicImage value="./images/icons/save.gif" styleClass="pic"/>
                    </a4j:commandLink>
                </rich:toolbarGroup>
                <rich:toolbarGroup>
                    <a4j:commandLink render="edit,errmessage"  action="#{partnertype.refresh}">
                        <h:graphicImage value="./images/icons/repeat.gif" styleClass="pic"/>
                    </a4j:commandLink>
                </rich:toolbarGroup>
                <rich:toolbarGroup>
                    <h:graphicImage value="./images/icons/document.gif" styleClass="pic"/>
                </rich:toolbarGroup>
                <rich:toolbarGroup>
                    <h:commandLink   action="#{partnertype.myprint}">
                        <h:graphicImage value="./images/icons/print.gif" styleClass="pic"/>
                    </h:commandLink>
                </rich:toolbarGroup>
                <rich:toolbarGroup>
                    <h:graphicImage value="./images/icons/help.gif" styleClass="pic"/>
                </rich:toolBarGroup>
            </rich:toolBar>

            <h:panelGrid columns="2" width="100%" columnClasses="col1,col2"  id="edit">
                <rich:tree style="width:300px"
                           toggleType="client"
                           render="partnertypeinfo"
                           value="#{partnertype.treeNode}"
                           selectionChangeListener="#{partnertype.selected}"
                           var="ipartnertype">
                    <rich:treeNode>
                        <h:outputText value="[#{ipartnertype.id}]#{ipartnertype.name}" />
                    </rich:treeNode>
                </rich:tree>
                <h:panelGroup>
                    <h:panelGrid columns="3" id="partnertypeinfo">
                        <h:outputText value="#{msgs.invenTypeCode}："/>
                        <h:outputText rendered="#{partnertype.showAble}" value="#{partnertype.partnertype.id}"/>
                        <h:inputText rendered="#{partnertype.editAble}" binding="#{partnertype.partnertypeCode}" id="partnertypecode" value="#{partnertype.partnertype.id}">
                        </h:inputText>
                        <h:message for="partnertypecode"/>

                        <h:outputText value="#{msgs.invenTypeName}："/>
                        <h:outputText rendered="#{partnertype.showAble}" value="#{partnertype.partnertype.name}"/>
                        <h:inputText rendered="#{partnertype.editAble}" id="partnertypename" value="#{partnertype.partnertype.name}"/>
                        <h:message for="partnertypename"/>

                        <h:outputText value="所属："/>
                        <h:outputText rendered="#{partnertype.showAble}" value="#{partnertype.partnertype.type}"/>
                        <h:selectOneRadio rendered="#{partnertype.editAble}" value="#{partnertype.partnertype.isType}" >
                            <f:selectItem itemLabel="客户" itemValue="0" />
                            <f:selectItem itemLabel="供应商" itemValue="1" />
                        </h:selectOneRadio>
                    </h:panelGrid>
                </h:panelGroup>
            </h:panelGrid>

            <h:outputLabel value="警告：" /><br />

            <h:outputLabel id="errmessage" value="#{queryBean.err.errtip}" style="color:red" />
        </rich:panel>
    </h:form>

</ui:composition>